﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Itfort;
using MySoft.Data;

namespace WanPiJie
{
	/// <summary>
	/// 成长发育指标
	/// </summary>
	public class GrowthIndicatorService : IGrowthIndicatorService
	{
		private DbSession dbSession = new DbSession("Ehr");

		/// <summary>
		/// 获取成长发育指标。
		/// </summary>grow
		/// <param name="ageMonth">年龄，使用月份表示</param>
		/// <returns></returns>
		public GrowthIndicator GetGrowthIndicatorByAge(double ageMonth)
		{
			return dbSession.Single<_GrowthIndicator>(_GrowthIndicator._.AgeLower <= ageMonth && _GrowthIndicator._.AgeUpper > ageMonth)
				.Convert2<GrowthIndicator>();
		}

		/// <summary>
		/// 获取所有成长发育指标。
		/// </summary>
		/// <returns></returns>
		public List<GrowthIndicator> GetGrowthIndicators()
		{
			return dbSession.From<_GrowthIndicator>().ToList()
				.Convert2<GrowthIndicator>();
		}
	}
}
